<template>
  <!--选择属性栏-->
  <div class="selector">
    <div class="type-row">
      <div class="key">品牌</div>
      <div class="value">
        <ul class="logos">
          <li
            v-for="trademark in trademarkList"
            :key="trademark.tmId"
            @click="trademarkHandler(trademark)"
          >
            {{ trademark.tmName }}
          </li>
        </ul>
        <div class="more">
          <a href="" class="but">多选</a>
          <a href="">更多</a>
        </div>
      </div>
    </div>
    <div class="type-row" v-for="attr in attrsList" :key="attr.attrId">
      <div class="key">{{ attr.attrName }}</div>
      <div class="value">
        <ul>
          <li
            v-for="(attrValue, index) in attr.attrValueList"
            :key="index"
            @click="attrInfo(attr, attrValue)"
          >
            {{ attrValue }}
          </li>
        </ul>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
export default {
  name: "SearchSelector",
  computed: {
    ...mapGetters(["trademarkList", "attrsList"]),
  },
  methods: {
    //品牌标签点击事件处理函数
    trademarkHandler(trademark) {
      this.$emit("tradeMarkInfo", trademark);
    },
    //售卖属性点击事件
    attrInfo(attr, attrValue) {
      this.$emit("attrInfo", attr, attrValue);
    },
  },
};
</script>

<style lang="css" scoped>
/*选择属性栏*/
.selector {
  width: 100%;
  border: 1px solid #ddd;
  margin-bottom: 5px;
  overflow: hidden;
}
.selector .type-row {
  position: relative;
  min-height: 47px;
  width: 100%;
  height: 100%;
  border-top: 1px solid #ddd;
  overflow: hidden;
}
.selector .type-row .key {
  position: absolute;
  width: 120px;
  height: 100%;
  background: #f1f1f1;
  text-align: right;
  line-height: 26px;
  padding: 10px 10px 0 15px;
}
.selector .type-row .value {
  width: 1078px;
  float: left;
  overflow: hidden;
  margin-left: 120px;
  margin-bottom: 10px;
  padding: 10px 0 0 15px;
  color: #333;
}
.selector .type-row .value ul {
  float: left;
  width: 970px;
}
.selector .type-row .value ul li {
  float: left;
  padding: 0 10px;
  line-height: 26px;
  cursor: pointer;
}
.selector .type-row .value .logos li {
  border: 1px solid #e4e4e4;
  margin: -1px -1px 0 0;
  width: 105px;
  height: 52px;
  text-align: center;
  line-height: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  color: #e1251b;
  font-style: italic;
  font-size: 14px;
  padding: 0;
  cursor: pointer;
}
.selector .type-row .value .more {
  position: absolute;
  right: 5px;
  top: 10px;
}
.selector .type-row .value .more a {
  display: inline-block;
  padding: 0 10px;
  height: 20px;
  line-height: 20px;
  text-align: center;
}
.selector .type-row .value .more .but {
  border: 1px solid #d5d5d5;
}
</style>
